<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2025/5/14
  Time: 14:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>发布商品</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link type="text/css" rel="stylesheet" href="css/base.css">
    <link type="text/css" rel="stylesheet" href="css/common.css">
    <link type="text/css" rel="stylesheet" href="css/index.css">
    <script type="text/javascript" src="js/goods.js" defer></script>
    <script type="text/javascript" src="js/index.js" defer></script>
</head>
<body>

<%--导入导航栏header效果--%>
<jsp:include page="header.jsp">
    <jsp:param name="flag" value="5"/>
</jsp:include>

<%--商品发布模块--%>
<div class="container">
    <c:if test="${!empty gas}">
        <div class="publish-success" id="publishSuccess">${gas}</div>
    </c:if>
    <c:if test="${!empty failgas}">
        <div class="publish-success" id="publishSuccess">${failgas }</div>
    </c:if>
    <form class="publish-form" action="/goods_publish" method="post" enctype="multipart/form-data">
        <div class="form-group">
            <label for="goodsName">物品名称</label>
            <input type="text" id="goodsName" name="goodsName" required>
            <div class="error" id="nameError"></div>
        </div>
        <div class="form-group">
            <label for="goodsDetail">物品描述</label>
            <textarea id="goodsDetail" rows="5" name="goodsDetail" required></textarea>
            <div class="error" id="detailError"></div>
        </div>
        <div class="form-group">
            <label for="pickupAddress">取件地址</label>
            <textarea id="pickupAddress" rows="5" name="pickupAddress" required></textarea>
            <div class="error" id="pickupAddressError"></div>
        </div>
        <div class="form-group">
            <label for="proxyAddress">交付地址</label>
            <textarea id="proxyAddress" rows="5" name="proxyAddress" required></textarea>
            <div class="error" id="proxyAddressError"></div>
        </div>
        <div class="form-group">
            <label for="phoneNumber">联系号码</label>
            <input type="text" id="phoneNumber" name="phoneNumber" class="form-control" required pattern="^1[3-9]\d{9}$">
            <div class="error" id="phoneError">请输入有效的11位手机号码</div>
        </div>
        <div class="form-group">
            <label>图片上传</label>
            <div class="image-uploader">
                <div class="images-preview-group">
                      <div class="images-preview">
                          <span class="plus-icon">+</span>
                      </div>
                    <input type="file" id="image" accept="image/*" name="cover" required>
                    <button class="delete-Btn" data-index="1">×</button>
                </div>
            </div>
            <div class="error" id="imageError"></div>
        </div>
        <div class="form-group">
            <label for="category">商品类别</label>
            <select id="category" name="categoryId" required>
                <option value="">请选择</option>
                <c:forEach items="${categoryList}" var="t">
                    <option value="${t.id}">${t.name}</option>
                </c:forEach>
            </select>
        </div>
        <div class="form-group">
            <label for="price">酬 &nbsp; &nbsp;劳</label>
            <input type="number" id="price" min="0.00" step="0.01" name="price" required>
        </div>
        <button type="submit" class="goods-publish-btn">发 布 代 取</button>
    </form>
</div>


<%--footer模块--%>
<jsp:include page="footer.jsp"></jsp:include>


</body>
</html>

